package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;

import com.heima.model.wemedia.dtos.WmSensitiveDto;
import com.heima.wemedia.service.SenSitiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/api/v1/sensitive")
public class SenSitiveController {

    @Autowired
    private SenSitiveService senSitiveService;

    //查询敏感此列表
    @PostMapping("list")
    public ResponseResult sensitiveList(@RequestBody WmSensitiveDto dto){
        return senSitiveService.getList(dto);
    }

    //新增敏感词
    @PostMapping("save")
    public ResponseResult saveSensitive(@RequestBody Map<String,String> map){
        return senSitiveService.saveSensitive(map);
    }

    //修改敏感词
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody Map<String,String> map){
        return senSitiveService.updateSensitive(map);
    }

    //删除敏感词
    @DeleteMapping("/del/{id}")
    public ResponseResult delectSensitive(@PathVariable int id){
        return senSitiveService.delectSensitive(id);
    }


}
